Python Primer: The Board
Before we can build an AI, we need a digital representation of the world. In Gomoku, our world is a 15x15 or 19x19 grid. In Python, the standard way to represent a grid is a List of Lists.
Concept: A Spreadsheet in Memory
Think of the outer list as the "spreadsheet" containing all rows. Each element inside it is another list representing the columns of that specific row.
Accessing Data
board[0]returns the entire top row (a list).board[1][2]accesses Row 1, Column 2.
⚠️ Common Coordinate Error
In mathematics, we say $(x, y)$ where $x$ is horizontal and $y$ is vertical. In Python matrices, we access board[row][col].
Since "Row" corresponds to the vertical position ($y$) and "Col" to the horizontal ($x$), the code is effectively board[y][x]. Do not mix this up, or your AI will look at the board sideways!